<template>
  <div v-if="goods" class="xtx-goods-page">
    <div class="container">
      <!-- 面包屑 -->
      <Relevant />
      <!-- 商品信息 -->
      <div class="goods-info">
        <div class="media">
          <GoodsImage :images="goods.mainPictures" />
          <GoodsSales />
        </div>
        <div class="spec">
          <GoodsName :goods="goods" />
          <!-- sku组件 -->
          <GoodsSku :goods="goods" />
        </div>
      </div>
      <!-- 商品推荐 -->
      <Relevant />
      <!-- 商品详情 -->
      <div class="goods-footer">
        <div class="goods-article">
          <!-- 商品+评价 -->
          <div class="goods-tabs" />
          <!-- 注意事项 -->
          <div class="goods-warn" />
        </div>
        <!-- 24热榜+专题推荐 -->
        <div class="goods-aside" />
      </div>
    </div>
  </div>
</template>

<script>
import Relevant from './components/Relevant'
import GoodsImage from './components/GoodsImage.vue'
import GoodsSales from './components/GoodsSales'
import GoodsName from './components/GoodsName.vue'
import GoodsSku from './components/GoodsSku.vue'
import { findGoods } from '@/api/product'
import { useRoute } from 'vue-router'
import { ref } from 'vue'
export default {
  name: 'Goods',
  components: { Relevant, GoodsImage, GoodsName, GoodsSales, GoodsSku },
  setup() {
    const route = useRoute()
    const goods = ref(null)
    findGoods(route.params.id).then(data => {
      goods.value = data.result
      console.log(data.result)
    })
    return { goods }
  }
}
</script>

<style scoped lang='less'>
.goods-info {
  min-height: 600px;
  background: #fff;
  display: flex;
  .media {
    width: 580px;
    height: 600px;
    padding: 30px 50px;
  }
  .spec {
    flex: 1;
    padding: 30px 30px 30px 0;
  }
}
.goods-footer {
  display: flex;
  margin-top: 20px;
  .goods-article {
    width: 940px;
    margin-right: 20px;
  }
  .goods-aside {
    width: 280px;
    min-height: 1000px;
  }
}
.goods-tabs {
  min-height: 600px;
  background: #fff;
}
.goods-warn {
  min-height: 600px;
  background: #fff;
  margin-top: 20px;
}
</style>
